<template>
    <div class="layui-fluid">
        <div class="layui-row">
            <form class="layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <span class="x-red">*</span>模糊信息</label>
                    <div class="layui-input-inline">
                        <input type="text" required="" class="layui-input" v-model="company">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <span class="x-red">*</span>姓名</label>
                    <div class="layui-input-inline">
                        <input type="text" required="" class="layui-input" v-model="name">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <span class="x-red">*</span>手机</label>
                    <div class="layui-input-inline">
                        <input type="text" required="" class="layui-input" v-model="phone">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <span class="x-red">*</span>模糊需求</label>
                    <div class="layui-input-inline">
                        <input type="text" required="" class="layui-input" v-model="leadsDetail">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <span class="x-red">*</span>跟进人</label>
                    <div class="layui-input-inline">
                        <input type="text" required="" class="layui-input" v-model="leadsOwner">
                    </div>
                </div>
                <div style="text-align: center">
                    <button class="layui-btn" @click="submitForm()">提交</button>
                </div>
            </form>
        </div>
    </div>
</template>

<script>
    import { mapActions, mapState } from "vuex";
    import service from "../../../src/service";
    export default {
        data(){
            return{
                id:"",
                company:"",
                name:"",
                phone:"",
                leadsDetail:"",
                leadsOwner:""
            }
        },
        methods:{
            submitForm(){
                var lead = {
                    "name":this.name,
                    "phone":this.phone,
                    "company":this.company,
                    "leadsDetail":this.leadsDetail,
                    "leadsOwner":this.leadsOwner
                }
                service.instance().put("http://"+window.location.hostname+":8011/lead/add",lead)
                    .then((response)=> {
                        if(response.data == "1"){
                            this.getleads();
                            this.$layer.alert("添加成功");
                            parent.closeAll()
                        }
                    })
            },
            ...mapActions(["getleads"])
        },
        computed:{

        },
        mounted() {

        }
    }
</script>

<style scoped>

</style>